require "./lib/permalinkable/version"

Gem::Specification.new do |s|
  s.name        = "permalinkable"
  s.version     = Permalinkable::Version::STRING
  s.platform    = Gem::Platform::RUBY
  s.authors     = ["Yang Ou"]
  s.email       = ["ouyang871223@gmail.com"]
  s.homepage    = "http://rubygems.org/gems/permalinkable"
  s.summary     = "Generate permalink attributes on ActiveRecord FPE'ed from database ids."
  s.files         = `git ls-files`.split("\n")
  s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
  s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
  s.require_paths = ["lib"]
  s.licenses      = ['MIT']
  s.description   = <<-DESC
    This is a gem originated from another gem called permalink.
    Since I often want a permalink that provides no way to tell the database ids,
    I came up with the idea about encrypting the id and prepending it to the permalink.
    For more information about FPE(Format Preserving Encryption), please consult the wikipedia.

    The encryption method of current release is simply RC4-40 with a configurable key.
    Note, RC4-40 is not a strong encryption algorithm at all, and you shouldn't rely on it to delivery sensitive
    information. Also, to prevent inconsistance of encryption, and duplication(although the chance is very low)
    you should keep your key as a secret and never change it.

    The original implementation of generating permalink involves a infite loop to check uniqueness in database.
    It's slow, inefficient and most importantly, it still can't prevent race condition. And since we are using
    a FPE algorithm on the database id, which is garanteed to be unique from database, we don't need to put ourselves
    in that inefficient loop.

    Finally, what's the purpose of this gem?
    It's only a gem that helps hiding your database ids.
  DESC

  s.add_runtime_dependency "activerecord", '~> 4.0'
  s.add_runtime_dependency "hashie", '~> 3.1'
  s.add_development_dependency "sqlite3", '~> 1.3'
  s.add_development_dependency "rspec", '~> 3.0'
end